package com.epta.common;

import java.util.EnumSet;

/**
 * Created by Administrator on 2017/11/1 0001.
 */
public enum Role {
    NORMAL(0, "普通用户"),
    ADMIN(1,"管理员");

    private int code;
    private String value;

    Role(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public int getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    public static String getValue(int code){
        for(Role role : EnumSet.allOf(Role.class)){
            if(role.getCode() == code){
                return role.getValue();
            }
        }
        return null;
    }
}
